import http from "@/axios/http";

// 查询所有项目
const Hp_GetScore = (params) => {
  return http({
    method: "get",
    url: "/projectscore/search",
    params,
  });
};

// 新建项目组
const Hp_AddScore = (data) => {
  return http({
    method: "put",
    url: "/projectscore/save",
    data,
  });
};

// 发布
const Hp_ScoreIssue = (id) => {
  return http({
    method: "post",
    url: "/projectscore/release/" + id,
  });
};

// 评分
const Hp_AccomplishScore = (data) => {
  return http({
    method: "post",
    url: "/projectscore/score",
    data,
  });
};

// 崔评分
const Hp_Collection = (id) => {
  return http({
    method: "post",
    url: `/projectscore/urge/${id}`,
  });
};
// 删除项目
const Hp_DelProjectscore = (id) => {
  return http({
    method: "DELETE",
    url: `/projectscore/del/${id}`,
  });
};

// 添加个人目标
const Hp_AddTarget = (data) => {
  return http({
    method: "PUT",
    url: `/projectscore/target/saveUserTarget`,
    // header: {
    //   "Content-Type": "application/json",
    // },
    // data:JSON.parse(JSON.stringify(data)),
    data,
  });
};

// 个人目标修改
const Hp_UpdateTarget = (data) => {
  console.log(JSON.parse(JSON.stringify(data)), 123);
  return http({
    method: "POST",
    url: `/projectscore/target/update`,
    // header: {
    //   "Content-Type":"application/json",
    // },
    data,
  });
};

// 审批个人目标
const Hp_TargeAgree = (data) => {
  return http({
    method: "POST",
    url: `/projectscore/target/agree`,
    header: {
      "Content-Type": "application/json",
    },
    data: JSON.parse(JSON.stringify(data)),
  });
};

export default {
  Hp_GetScore,
  Hp_AddScore,
  Hp_ScoreIssue,
  Hp_AccomplishScore,
  Hp_Collection,
  Hp_DelProjectscore,
  Hp_AddTarget,
  Hp_UpdateTarget,
  Hp_TargeAgree,
};
